package example;


import ws.DevelopmentServiceDelegate;
import ws.DevelopmentServiceServiceLocator;
import ws.Feature;
import ws.SerialNumber;

import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;

public class HelloWorldClient {
    public static void main(String[] argv) {
        DevelopmentServiceServiceLocator locator = new DevelopmentServiceServiceLocator();
        DevelopmentServiceDelegate service;
        try {
            service = locator.getDevelopmentServicePort();
            SerialNumber serialNumber = service.getSnDetail("JKSWKTMBVEZ6MNRW");
            Feature[] features = serialNumber.getFeature();

            for (Feature feature : features) {
                System.out.println(String.format("[%s]", feature.getName()));
                if (feature.getName().equals("ADAS")) {
                    System.out.println("ok");
                    feature.setValue(2);
                }

            }
//            Product[] list = service.listProduct(0, 10, null);
//            for (Product product : list) {
//                System.out.println(product.getProduct().getName());
//            }
        } catch (ServiceException | RemoteException e) {
            e.printStackTrace();
        }
    }
}
